<template>
  <div class="app-container booknav">
    <span v-if="$route.path == '/book/info'||$route.path == '/book/pdf'" class="router-title">当前位置：<router-link to="/">首页</router-link> > <router-link to="/book">图书</router-link> > <span class="title" v-html="$route.query.bookName">图书</span></span>
    <ul v-else>
      <li><router-link to="/book/all">全部</router-link></li>
      <li v-for="(item,index) in list" :key="index">
        <router-link :to="item.path">{{item.name}}</router-link>
      </li>
    </ul>
  </div>
</template>

<script>
  import {GetClassList, GetBookDetailList} from "@/api/Api";
  import {getFirstLevel} from '@/api/index'
  export default {
  data() {
    return {
      list: [],
      columnId:null
    };
  },
  created(){
     getFirstLevel().then(res=>{
      const list = res.data.data
      list.map((val,index)=>{
        if('图书' == val.columnName){
         GetClassList(1,val.columnId ,this.currentPage,this.pageSize)
      .then(result=>{
        console.log(result,1)
        this.list = result.data.map((value,index) => {
              return {
                name:value.columnName,
                path:"/book/type/"+index+"?resType="+value.resType+'&columnId='+value.columnId
              }
        })
      })
      .then(result=>{

      })
        }
      })
    })
   
  },
  components: {}
};
</script>
<style lang="less" scoped>
.custom-dz{
  .booknav ul li .is-active{
    color: #e93926;
  }
}
.booknav {
  overflow: hidden;
  padding: 30px 0;
  .router-title{
    font-size: 15px;
  }
  ul {
    float: left;
    padding-left: 0px;
    li {
      float: left;
      margin-right: 56px;
      user-select: none;
      padding: 10px 0;
      a {
        text-decoration: none;
        font-size: 20px;
        display: block;
        color: #000;
      }
      .is-active {
        color: #15c798;
      }
    }
    li:nth-child(1) {
      a {
        padding-left: 0px;
      }
    }
  }
}
</style>


